package fic.storefinder.server.rpcservice;

import java.sql.SQLException;
import java.util.ArrayList;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

import fic.storefinder.client.service.StoreService;
import fic.storefinder.server.db.POITable;
import fic.storefinder.shared.serializable.POI;

@SuppressWarnings("serial")
public class StoreServiceImpl extends RemoteServiceServlet implements StoreService {

	
	/* (non-Javadoc)
	 * @see fic.storefinder.client.service.StoreService#getStoreList()
	 */
	@Override
	public ArrayList<POI> getStoreList() throws Exception {
		POITable poiTable = new POITable();
		ArrayList<POI> retValue = null;
		try {
			retValue = poiTable.getAllActivePOI();
		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
		return retValue;
	}


	/* (non-Javadoc)
	 * @see fic.storefinder.client.service.StoreService#insertPOI(fic.storefinder.shared.serializable.POI)
	 */
	@Override
	public String insertPOI(POI poi) throws Exception {
		POITable poiTable = new POITable();
		try {
			poiTable.insertPOI(poi);
		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
		return null;
	}

	/* (non-Javadoc)
	 * @see fic.storefinder.client.service.StoreService#deletePOI(fic.storefinder.shared.serializable.POI)
	 */
	@Override
	public String deletePOI(POI poi) throws Exception {
		try {
			POITable poiTable = new POITable();
			poiTable.deletePOI(poi);
		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
		return null;
	}




	/* (non-Javadoc)
	 * @see fic.storefinder.client.service.StoreService#updatePOI(fic.storefinder.shared.serializable.POI)
	 */
	@Override
	public String updatePOI(POI poi) throws Exception {
		try {
			POITable poiTable = new POITable();
			poiTable.updatePoi(poi);
		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
		return null;
	}

	

}
